<template lang="html">
  <div class="publicBox">
    <div class="publicBoxContent fundsManagement">
      <div class="fundsManagementSearch">
        <el-form :inline="true" :model="formInline" class="demo-form-inline">
          <el-form-item label="交易日期">
            <el-date-picker v-model="formInline.date" type="daterange"  value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="onSubmit">查询</el-button>
          </el-form-item>
        </el-form>
      </div>
      <div class="fundsManagementBox">
        <el-table :data="tableData" border v-loading="loading" style="width: 100%">
          <el-table-column prop="create_at" label="创建时间"></el-table-column>
          <el-table-column prop="remark" label="交易单号"></el-table-column>
          <el-table-column label="交易类型">
            <template slot-scope="scope">
              余额支付
            </template>
          </el-table-column>
          <el-table-column prop="scene.text" label="交易方式"></el-table-column>
          <el-table-column prop="money" label="交易金额(元)"></el-table-column>
          <el-table-column  label="状态">
            <template slot-scope="scope">
              已完成
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div class="fundsManagementPage">
        <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-size="15"
        layout="total, prev, pager, next, jumper"
        :total="total">
        </el-pagination>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name : "fundsManagement",
    data : function () {
      return {
          loading:true,
        formInline : {
          date : ['','']
        },
        tableData : [],
        currentPage : 1,
          total:1,
          pageSize:15

      }
    },
    created(){
      this.merchantFunds();
    },
    methods : {
      merchantFunds(){
        this.$HttpGet("/index.php?s=/admin/home.balance/index",{
          start_time:this.formInline.date[0],
          end_time:this.formInline.date[1],
            page: this.currentPage,
            pageSize: this.pageSize,
        }).then(res => {
            this.loading=false;
          this.tableData = res.data.data;
          this.total=res.data.total;
        })
      },
      onSubmit () {
        this.merchantFunds();

      },
      handleSizeChange () {

      },
      handleCurrentChange (page) {
          this.currentPage=page;
          this.merchantFunds();
      }
    }
  }
</script>

<style lang="scss" scoped>
  .fundsManagement {
    .fundsManagementBox {
      margin-top: 20px;
    }
    .fundsManagementPage {
      margin-top: 20px;
      text-align: right;
      margin-bottom: 50px;
    }
  }
</style>
